<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>index</title>
<!--<link href="<?php echo BASE_URL;?>/public/css/base.css" rel="stylesheet" type="text/css" />-->
<script type='text/javascript' src='<?php echo BASE_URL;?>/public/js/jquery.min.js'></script>
<script type='text/javascript' src='<?php echo BASE_URL;?>public/js/main.js'></script>

 <style>
.lightbox{width:300px;background:#FFFFFF;border:1px solid #ccc;line-height:25px; top:20%; left:20%;display:none;}
.lightbox dt{background:#f4f4f4; padding:5px;}
</style>   
</head>
<body id="home" class="own">
    <!-- header -->
    <?php TPL::plugin('include/header');?>
    <!-- end header -->
	<div style="clear:both"></div>
<div id="swap">
<div id="mainG">
<img src="<?php echo BASE_URL;?>/public/upload/<?php echo $mainG['pic']; ?>" style="float:left;" />
<input type="button" value="购买" onclick="order('<?php  echo $mainG['id']; ?>')" />
<span style="float:left;" >
<h1><?php echo $mainG['name']; ?></h1>
价格：<?php echo $mainG['price']; ?><br/>
运费：<?php echo $mainG['freight']; ?><br/>
税率：<?php echo $mainG['taxrate']; ?>%<br/>
说明<?php echo $mainG['remark']; ?>
</span>
</div>
<div style="clear:both"></div>
<ul id="list">
	<?php if($listG):?>
	<?php foreach($listG as $value):?>
		<li>
			<span><?php echo $value['name'];?></span>

		</li>
	<?php endforeach;?>
	<?php endif;?>
</ul>
</div>
<dl id="alertBox" class="lightbox" >
  <dt id="idBoxHead"><b>LightBox</b> </dt>
  <dd>
    <span id="alertinfo">loading...</span>
    <br /><br />
  </dd>
</dl>

    <!-- header -->
    <?php TPL::plugin('include/footer');?>
    <!-- end header -->
</body>
<?php $uid = User::uid(); ?>
<script>
var uid = '<?php echo $uid;?>';
function order(id){
	if(uid=='' || uid=='0') 
	{    
		$('#alertinfo').html('您没有登录，请登录.<br/><br/><input type="button" id="submitb" value="确定" onclick="login();"/><input type="button" value="取消" onclick="closeb();" />');
		$("#alertBox").show();
	}
   else 
	{
	   window.location.href= '<?php echo URL("order&gid=");?>' + id;
	}
}
function login()
{
		$('#alertinfo').html('<form action="<?php echo URL("account.ajaxLogin");?>" method="post" onsubmit="return ajax_post($(this));">帐号：<input name="username" type="text" \><br/>密码：<input name="password" type="password" \><br/><br/><input type="submit" value="登录" /><input type="button" value="取消" onclick="closeb();" /></form>');
}
function afterlogin()
{
	uid = '1';
	$("#alertBox").hide();
	$("#userzone").html('<a href="<?php echo URL("account.ucenter");?>">个人中心</a>  <a href="<?php echo URL("account.logout");?>">退出</a>');		
}
function closeb()
{
	$("#alertBox").hide();
}

</script>
</html> 